package com.songcha.module_category.ui.activity.category_detail

import com.songcha.library_base.mvvm.base.BaseRepository
import com.songcha.library_business.bean.book.BookListBean
import com.songcha.module_category.api.CategoryApiManager
import com.songcha.module_category.api.CategoryApiService
import io.reactivex.Observable
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject

class CategoryDetailRepository:BaseRepository() {
    fun getCategoryDetailBookList(channelSubId:Int,currentPage:Int,status:Int,wordsStart:Int,wordsEnd:Int):Observable<BookListBean>{
        val json=JSONObject().apply {
            if(status>0)
                put("status",status)
            if(wordsStart>0)
                put("wordsStart",wordsStart)
            if(wordsEnd>0)
                put("wordsEnd",wordsEnd)
        }
        return CategoryApiManager.api.getCategoryDetailBookList(channelSubId,currentPage,json.toString().toRequestBody())
    }
}